import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:readmore/readmore.dart';
import 'package:vischat/modules/home/user/user_controller.dart';

class UserPosts extends GetView<UserController> {
  @override
  const UserPosts({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        color: const Color(0xFFE5E6E8),
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(24.r),
          topRight: Radius.circular(24.r),
        ),
      ),
      child: Column(
        children: [
          Container(
            width: double.infinity,
            padding: EdgeInsets.symmetric(horizontal: 30.w, vertical: 14.h),
            decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.only(
                topLeft: Radius.circular(12.r),
                topRight: Radius.circular(12.r),
              ),
            ),
            child: ReadMoreText(
              // TODO 用户简介
              '',
              trimMode: TrimMode.Line,
              trimLines: 2,
              colorClickableText: Colors.blue,
              trimCollapsedText: 'button.expand'.tr,
              trimExpandedText: 'button.retract'.tr,
              style: const TextStyle(color: Colors.grey),
            ),
          ),
          Container(
            color: Colors.white,
            child: TabBar(
              tabs: controller.tabs.map((item) => Text(item)).toList(),
              controller: controller.tabController,
              padding: EdgeInsets.symmetric(vertical: 10.w),
              labelColor: Colors.lightBlueAccent,
              labelStyle: TextStyle(fontSize: 28.sp),
              unselectedLabelColor: Colors.grey,
              indicator: UnderlineTabIndicator(
                borderSide: BorderSide(
                  color: Colors.lightBlueAccent,
                  width: 1.w,
                ),
              ),
            ),
          ),
          Expanded(
            child: Container(
              color: Colors.white,
              child: TabBarView(
                controller: controller.tabController,
                children: [
                  Text('page.user.tab.posts'.tr),
                  Text('page.user.tab.collect'.tr),
                  Text('page.user.tab.message'.tr),
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }
}
